package org.lojzes.minstruts.demos;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lojzes.minstruts.annotation.Action;
import org.lojzes.minstruts.annotation.RequestMapping;

@Action(name = "/student")
public class StudentAction {
	private String name;
	private String address;
    /**
     * 约定：action 方法的参数个数为2;类型必须为 HttpServletRequest 和 HttpServletResponse
     * @param request
     * @param httpServletResponse
     * @return
     */
	@RequestMapping(parameter = "/find")
	public String find(HttpServletRequest request, HttpServletResponse httpServletResponse) {
		String url = "";
		if (name.equals("lyy") && address.equals("123")) {
			url = "success.jsp";
		} else {
			url = "failed.jsp";
		}
		request.setAttribute("name", name);
		return url;
	}
	 
	@RequestMapping(parameter = "/delete")
	public String delete(HttpServletRequest request, HttpServletResponse httpServletResponse) {
		String url = "";
		return url;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}
